﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class no_this_city : System.Web.UI.Page
{
    ctpDataContext db;

    protected void Page_Load(object sender, EventArgs e)
    {
        db = new ctpDataContext();

        if (!this.IsPostBack)
        {
            this.Label1.Text = Request["city"];
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        


        var city_search = from p in db.ct_profiles
                          where p.title == this.TextBox1.Text.Trim().ToLower()
                          select p;

        if (city_search.Count() != 0)
        {
            Response.Redirect("city.aspx?no=" + city_search.First().no.ToString());
        }
        else
        {
            Response.Redirect("no_this_city.aspx?city=" + this.TextBox1.Text);
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("create_city.aspx?title=" + Request["city"]);
    }
}
